package com.gsabs.dao;

import javax.management.RuntimeErrorException;

import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;

public class HibernateUtil {
	private static final SessionFactory sessionFactory = buildSessionFactory();

	private static SessionFactory buildSessionFactory() {
		try {

			// Create the SessionFactory from hibernate.cfg.xml
			SessionFactory sf = new Configuration().configure()
					.buildSessionFactory();

			return sf;

		} catch (RuntimeErrorException ex) {

			throw ex;
		}
	}

	public static SessionFactory getSessionFactory() {
		return sessionFactory;
	}

}
